/*
自己选择的路 ,跪着也要走完。朋友们 , 虽然这个世界日益浮躁起来,只
要能够为了当时纯粹的梦想和感动坚持努力下去 , 不管其它人怎么样,我
们也能够保持自己的本色走下去。
To the world , you will be a person , but to a person , you
will be the world .                               ——AKPower
*/
//作者:AKPower
//算法:
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <cstdio>
#include <string>
#include <stack>
#include <set>
#define IOS ios::sync_with_stdio(false), cin.tie(0)
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 10;
int n;
struct node
{
    int num, id;
} a[maxn];
int acopy[maxn];
vector<node> g[maxn];
int cnt[maxn];
int ans[maxn];
int main()
{
    IOS;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        g[i].clear();
        cnt[i] = 0;
    }
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i].num;
        acopy[i] = a[i].num;
        a[i].id = i;
        g[a[i].num].push_back(a[i]);
    }
    int size = unique(acopy + 1, acopy + n + 1) - acopy;
    bool flag = true;
    for (int i = 2; i <= size; i++)
    {
        if (acopy[i - 1] != acopy[i] - 1)
        {
            flag = false;
            break;
        }
    }
    if (!flag)
    {
        cout << "Impossible" << endl;
    }
    else
    {
        int num = 0; //表示顺序计数
        int p = 0;
        bool flag = true;
        while (flag)
        {
            if (cnt[p] >= 0 && cnt[p] < g[p].size())
            { //如果有
                ans[++num] = g[p][cnt[p]].id;
                cnt[p]++;
                p++;
            }
            else if (cnt[p] < 0)
            {
                if (p > 3)
                    p -= 3;
                else
                    flag = false;
            }
            else
            {
                flag = false;
            }
        }
    }

    getchar();
    getchar();
    return 0;
}
